Skip to content

DOC: Add Copy on write whatsnew #50470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 3, 2023
Merged

DOC: Add Copy on write whatsnew #50470

merged 4 commits into from
Jan 3, 2023

Conversation

phofl
Copy link
Member

@phofl phofl commented Dec 28, 2022

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

cc @mroeschke

As discussed in the other pr. This is for 1.5, will add another pr for the lazy copy methods.
Do you think it makes sense linking https://phofl.github.io/cow-introduction.html instead of explaining everything in here?

.. code-block:: python

with pd.option_context("mode.copy_on_write", True):
...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a small example that shows the effect of copy on write?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@mroeschke
Copy link
Member

Do you think it makes sense linking https://phofl.github.io/cow-introduction.html instead of explaining everything in here?

Sure, would be good to link to your article to learn more.

@datapythonista
Copy link
Member

Can you link to the other PR you mention in the description please? I'm missing the context.

Ok by me to add a link from the what's new to the blog post.

@phofl
Copy link
Member Author

phofl commented Dec 29, 2022

Thanks, added the initial pr that implemented it and added a link to the blog post. Happy to remove it, if any objections though.

@mroeschke mroeschke merged commit 07f0575 into pandas-dev:main Jan 3, 2023
@mroeschke
Copy link
Member

Thanks @phofl

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Jan 3, 2023
@phofl phofl deleted the doc_dcow branch January 3, 2023 21:47
phofl added a commit that referenced this pull request Jan 4, 2023
…50546)

Backport PR #50470: DOC: Add Copy on write whatsnew

Co-authored-by: Patrick Hoefler <[email protected]>
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phofl thanks for adding this to the whatsnew! (it was for too long on my to do list ..)

Comment on lines +310 to +314
Alternatively, copy on write can be enabled locally through:

.. code-block:: python

with pd.option_context("mode.copy_on_write", True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we should encourage this usage by explicitly mentioning it (it's a general option, so if you are familiar with the option function, you can always use it this way using the existing option_context).

This is tricky as this will only work if the data you are using it created within that block. Once you only put this around an operation, with data created before the block, things might go sideways.

(that's probably a limitation of the setting the option that we should document anyway)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep it for now, since support on the 1.5.x branch is limited. It's more or less just to try it out. But agree we should maybe document this more clearly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants